package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.FamilyMedicine;
import com.ruoyi.system.domain.MedicationRecord;
import com.ruoyi.system.domain.Medicine;
import com.ruoyi.system.mapper.FamilyMedicineMapper;
import com.ruoyi.system.mapper.MedicineMapper;
import com.ruoyi.system.service.IFamilyMedicineService;
import com.ruoyi.system.service.IMedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 药品信息Service业务层处理
 * 
 * @author shan
 * @date 2025-04-13
 */
@Service
public class FamilyMedicineServiceImpl implements IFamilyMedicineService
{
    @Autowired
    private FamilyMedicineMapper medicineMapper;



    /**
     * 查询药品信息
     * 
     * @param id 药品信息主键
     * @return 药品信息
     */
//    @Override
//    public Medicine selectMedicineById(Long id)
//    {
//        return medicineMapper.selectMedicineById(id);
//    }

    /**
     * 查询药品信息列表
     * 
     * @param medicine 药品信息
     * @return 药品信息
     */
//    @Override
//    public List<Medicine> selectMedicineList(Medicine medicine)
//    {
//        return medicineMapper.selectMedicineList(medicine);
//    }
    @Override
    public int insertFamilyMedicine(FamilyMedicine medicine) {
        medicine.setCreateTime(new Date());
        medicine.setUpdateTime(new Date());
        String uId = UUID.randomUUID().toString();
        medicine.setId(uId);
        return medicineMapper.insertFamilyMedicine(medicine);
    }

    @Override
    public List<FamilyMedicine> selectMedicineList(FamilyMedicine medicine) {
        return medicineMapper.selectFamilyMedicineList(medicine);
    }

    @Override
    public int addMedRecord(MedicationRecord medicine) {
        medicine.setCreateTime(new Date());
        medicine.setUpdateTime(new Date());
        String uId = UUID.randomUUID().toString();
        medicine.setId(uId);
        return medicineMapper.addMedRecord(medicine);
    }
}
